#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;
typedef unsigned long long ull;
typedef long double ldb;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back
#define vec vector<int>

int read(){int x = 0,sgn = 1;char ch = getchar();for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);return x*sgn;}

const int N = 1010;

int n,m,k,mod;
ll f[N][N];

ll qp(ll x,int t){ll res = 1;for(;t;t >>=1,x = x * x % mod) if(t & 1) res = res * x % mod;return res;}

ll Lagrange(ll *f,int k){
	if(k >= 1 && k <= m) return f[k];
	ll res = 0;
	for(int i = 1;i <= m;i++){
		ll a = f[i],b = 1;
		for(int j = 1;j <= m;j++)
			if(j ^ i){
				a = a * (k - j) % mod;
				b = b * (i - j) % mod;
			}
		a = (a + mod) % mod; b = (b + mod) % mod;
		res = (res + a * qp(b,mod-2) % mod) % mod;
	}
	return res;
}

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	k = in,n = in,mod = in; m = 2 * n + 1;
	for(int i = 0;i <= m;i++) f[0][i] = 1;
	for(int i = 1;i <= n;i++)
		for(int j = 1;j <= m;j++)
			f[i][j] = (f[i-1][j-1] * j % mod + f[i][j - 1]) % mod;
	ll ans = Lagrange(f[n],k);
	for(int i = 1;i <= n;i++) ans = ans * i % mod;
	printf("%lld\n",ans);
	return 0;
}
